package org.broadway.scripting;

/***
 * The ScriptRunner interface should be implemented to 
 * provide ability to run script files.  In most cases,
 * it will wrap the functionalities of an existing script engine.
 * 
 * @author vladimir vivien
 * @see ScriptEngine
 * @param <RESULT> A type returned after execution of the script.
 */
public interface ScriptRunner <RESULT> {
	/**
	 * The full path text of the location of the script file.
	 * @param fileName
	 */
	public void setScriptLocation(String fileName);
	
	/**
	 * The script engine to use to execute script file.
	 * @param engine
	 */
	public void setScriptEngine(ScriptEngine engine);
	
	/**
	 * A method to register named variables that can be
	 * passed to the executing script.
	 * @param param - name of the variable.
	 * @param value - value of the variable.
	 */
	public void putParameter(String param, Object value);

	/**
	 * Implement this method to actully runn the script.
	 * @return RESULT - type that contains result value returned by the script.
	 * @throws ScriptingException - thrown if anything goes wrong.
	 */
	public RESULT run() throws ScriptingException;
}
